﻿

 urlParameters = (function (script) {
    var l = script.length;
    for (var i = 0; i < l; i++) {
        me = !!document.querySelector ? script[i].src : script[i].getAttribute('src', 4);
        if (me.substr(me.lastIndexOf('/')).indexOf('menu_hover') !== -1) {
            break;
        }
    }
    return me.split('?')[1];
})(document.getElementsByTagName('script'))

/*!
 * 获取url参数值函数
 */
 GetParameters = function (name) {
     console.log(urlParameters);
    if (urlParameters && urlParameters.indexOf('&') > 0) {
        var parame = urlParameters.split('&'), i = 0, l = parame.length, arr;
        for (var i = 0 ; i < l; i++) {
            arr = parame[i].split('=');
            if (name === arr[0]) {
                return arr[1];
            }
        }
    } else if (urlParameters.indexOf("=") >= 0) {
        return urlParameters.split('=')[1];
    }
    return null;
 }

 function LoadUrl() {
     var url = "data.ashx?appname=test&type=share&callback=_mes";
     var script = document.createElement('script');
     script.src = url;
     document.getElementsByTagName('head')[0].appendChild(script);
     console.log(url)
 }
 function _mes(data) {
     console.log(data);
 }
 LoadUrl();